<?php 
	require_once("utils.php");
	require_once("obj/session.php");
	require_once("obj/task.php");
	require_once("obj/tasktime.php");

	$task = Task::getFromURL();
	$tasktimes = TaskTime::getForTaskAndUser($task->TaskId, $user->UserId);
	
	echo "<h3>".$task->Name."</h3>";
?>
<a href="<?php echo Utils::makeTaskTimeDetailUrl($task->TaskId,0); ?>">New</a>
<table border="1" style="word-wrap:break-word;table-layout:fixed;" class="datatable" width="100%" cellpadding="5" cellspacing="0">
<tr><th>Hours</th><th>Description</th><th>&nbsp;</th></tr>
<?php
	$ix = 0;
	foreach($tasktimes as $t){
		$i = $t->TaskTimeId;
		$h = $t->Hours;
		$d = $t->Description;
		$u = Utils::makeTaskTimeDetailUrl($task->TaskId,$i);
		$cs = $ix % 2 == 0 ? "row" : "altrow";
		
		$l = "&nbsp;";
		if($t->UserId == $user->UserId) {
			$l = "<a href=\"$u\">Edit</a>";
		}
		
		echo "<tr class=\"$cs\"><td>$h</td><td>$d</td><td>$l</td></tr>";
		$ix++;		
	}
?>
</table>
<?php echo count($tasktimes)." rows"; ?>